package com.kelp.codetoolkit.actions

import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.kelp.codetoolkit.license.CheckLicense
import java.awt.Frame
import javax.swing.JOptionPane

/**
 * @author: liuyuebai
 * @date: 2024/12/26 08:23
 * @description:
 */
class MakeCodeToolkitAction: AnAction(){

    companion object {
        private const val TITLE = "JB Marketplace"
    }

    override fun actionPerformed(event: AnActionEvent) {
//        val isLicensed = CheckLicense.isLicensed
//        val frame: Frame = JOptionPane.getRootFrame()
//
//        val cities = arrayOf(
//            "Prague",
//            "St. Petersburg",
//            "Munich",
//            "Moscow",
//            "Novosibirsk",
//            "Amsterdam",
//            "Boston, MA",
//            "Marlton, NJ",
//            "Foster City, CA"
//        )
//
//        val city = JOptionPane.showInputDialog(
//            frame,
//            "Please choose the city of your office:",
//            "City",
//            JOptionPane.PLAIN_MESSAGE,
//            null,
//            cities,
//            "St. Petersburg"
//        ) as? String
//
//        if (!city.isNullOrBlank()) {
//            val coffeeTypes = arrayOf(
//                "Espresso",
//                "Double Espresso",
//                "Cappuccino",
//                "Flat White",
//                "Caffè Americano",
//                "Caffè Latte",
//                "Long Black",
//                "Macchiato",
//                "Caffè mocha",
//                "Decaf Coffee",
//                "Hot Chocolate",
//                "Kakao",
//                "Tea"
//            )
//
//            val coffeeType = JOptionPane.showInputDialog(
//                frame,
//                "What kind of coffee would you prefer?",
//                "Coffee",
//                JOptionPane.PLAIN_MESSAGE,
//                null,
//                coffeeTypes,
//                "Espresso"
//            ) as? String
//
//            if (!coffeeType.isNullOrBlank()) {
//                if (isLicensed == true) {
//                    val message = "The $coffeeType is being prepared in JetBrains $city office.\n" +
//                            "Thank you and welcome to the JetBrains Marketplace!"
//                    JOptionPane.showMessageDialog(
//                        JOptionPane.getRootFrame(),
//                        message,
//                        TITLE,
//                        JOptionPane.INFORMATION_MESSAGE
//                    )
//                } else {
//                    val message = "Unfortunately, you have not obtain the license yet. We cannot prepare coffee for you.\n" +
//                            "Thank you and welcome to the JetBrains Marketplace!"
//                    JOptionPane.showMessageDialog(
//                        JOptionPane.getRootFrame(),
//                        message,
//                        TITLE,
//                        JOptionPane.INFORMATION_MESSAGE
//                    )
//                    CheckLicense.requestLicense("Please register our plugin!")
//                }
//            }
//        }
    }
}